package com.guoheng.hazard.sys.controller.hazard;

import com.guoheng.hazard.common.base.Result;
import com.guoheng.hazard.sys.model.dto.entpr.DealExaminationDTO;
import com.guoheng.hazard.sys.model.dto.hazard.CommitMajorHazardExamineDTO;
import com.guoheng.hazard.sys.service.hazard.MajorHazardExamineService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * 类功能描述:　MajorHazardExamineController
 *
 * @author fbl
 * @date 2019-11-15 15:56
 */
@RestController
@Validated
@Api(value = "重大危险源备案记录表")
public class MajorHazardExamineController {
    @Resource
    MajorHazardExamineService majorHazardExamineService;


    @ApiOperation(value = "查询重大危险源备案记录表")
    @GetMapping(value = "data/major/hazard/examine")
    public Result getHazardExamine(String entprName,Integer reviewStatus,Long entprId, @RequestParam(value = "pageNum") Integer pageNum, @RequestParam(value = "pageSize") Integer pageSize) {
        return majorHazardExamineService.getHazardExamine(entprName,reviewStatus,entprId, pageNum, pageSize);
    }

    @ApiOperation(value = "提交重大危险源备案审核")
    @PostMapping(value = "data/major/hazard/examine")
    public Result commitHazardExamine(@RequestBody @Valid CommitMajorHazardExamineDTO commitMajorHazardExamineDTO) {
        return majorHazardExamineService.commitHazardExamine(commitMajorHazardExamineDTO);
    }

    @ApiOperation(value = "处理重大危险源备案审核")
    @PutMapping(value = "data/major/hazard/examine/{id}")
    public Result dealHazardExamine(@PathVariable Long id, @RequestBody @Valid DealExaminationDTO dealExaminationDTO) {
        return majorHazardExamineService.dealHazardExamine(id, dealExaminationDTO);
    }

    @ApiOperation(value = "查询重大危险源备案记录详情")
    @GetMapping(value = "data/major/hazard/examine/{id}")
    public Result getHazardExamineDetail(@PathVariable Long id) {
        return majorHazardExamineService.getHazardExamineDetail(id);
    }

}